var allServer=({
	load: function (pageNum){
		$$.showPreloader("加载中");
		$.ajax({
			type : "POST",
			dataType : 'json',
			url : "../service/queryPackageList.do",
			data : {
				flag : 0 ,
				searchText : $("#keyword").val(),
				limit : 10,
				offset : pageNum
			},
			success : function(data) {
				var html="";
				if(pageNum ==0){
					$("#peoplelist").html("");
				}
				if(data.rows!=null && data.rows.length>0){
					for(var i=0;i<data.rows.length;i++){
						html+="<ul><li class=\"item-content\" style=\"padding-left: 0rem;\" onclick=\"toLink('serverOrderDetail.html?orderId="+data.rows[i].orderId+"')\">";
						html+=" <div class=\"item-media\">";
				        html+=" </div><div class=\"item-inner\"> <div class=\"item-title-row\">";
				        html+="<div class=\"item-title\">【保洁】"+data.rows[i].nickName+" ( "+data.rows[i].phone +")-"+data.rows[i].start_serviceDate+"</div>";
				        html+=" </div> <div class=\"item-subtitle\" style=\"font-size: 12px\">地址："+data.rows[i].address+"</div>";
				        html+=" </div></li> </ul>";
					}
				}else{
					html+="<ul><li class=\"item-content\">";
					html+=" 暂无数据...</li> </ul>";
					$("#loadmore").hide();
				}
				$("#peoplelist").append(html);
				$$.hidePreloader();
			},
			error: function(){
				$$.hidePreloader();
			}
		});
	},
	updatePayStatus : function (){
		$$.showPreloader("加载中");
		$.ajax({
			type : "POST",
			dataType : 'json',
			url : "../service/updateStatusNoMsg.do",
			data : {
				payStatus :$("#opt_payStatus").val(),
				status : $("#opt_status").val(),
				orderId : orderId
			},
			success : function(data) {
				allServer.queryPackageDetail();
				$$.alert("修改成功");
				$$.hidePreloader();
			},
			error: function(){
				$$.hidePreloader();
			}
		});
	},
	queryPackageDetail : function (){
    	$.ajax({
			url : path+"/service/queryPackageDetail.do",
			data : {
				"orderId": orderId,
			},
			type : "GET",
			dataType : 'json',
			cache : false,
			success : function(ret){
				if(ret.result = true){
					var serviceCount;
					if(ret.packageList[0].status==3){
						$(".tolink").show();
					}
					if(ret.packageList && ret.packageList.length>0){
						$.each(ret.packageList,function(i,n){
							$(".address--name").text(n.nickName);
							$(".address--phone").text(n.phone);
							$(".address--detail").text(n.address);
							$(".p1").text(n.serviceName);
							$(".p2").text(n.serviceDesc);
							$("#logo").attr("src",n.imgUrl);
							$("#start_serviceDate").text(ret.order[0].start_serviceDate);
							$("#status").text(statusArr[n.status]);
							$("#opt_payStatus").val(n.payStatus);
							$("#opt_status").val(n.status);
							$("#payStatus").text(paystatusArr[n.payStatus==null?0:n.payStatus]);
							if(n.chargesType == 1){
								serviceCount = parseInt(n.serviceCount)*4;
								$(".count").text(parseInt(ret.order[0].hours)+"小时");
								$(".number").text(parseInt(n.serviceCount)*4);
							}else if (n.chargesType == 2){
								serviceCount = parseInt(n.serviceCount);
								$(".count").text(ret.order[0].hours+"小时");
								$(".number").text(n.serviceCount);
							}
							$(".money").text(n.price);
							$(".date").text(formatDate(n.createTime));
						})
					}
					var done = 0;
					
				}
			}
		})
    }
	
})